package com.scs.application.modules.settlement.dto;

import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.List;

/**
 * @description: 库存快照DTO
 */
@Data
public class StockSnapshotDTO implements Serializable {

    @NotBlank(message = "期号不能为空")
    private String periodNo;

    /**
     * 删除现有数据
     */
    private boolean deleteExisting = false;

    @Valid
    @NotNull(message = "至少需要一条库存明细")
    @Size(min = 1, message = "至少需要一条库存明细")
    private List<StockItem> items;

    @Data
    public static class StockItem {

        @NotBlank(message = "耗材编码不能为空")
        private String materialCode;

        @NotNull(message = "期末库存数量不能为空")
        private Double qty;
    }

}

